const KoaRoter = require("@koa/router");
const { verifyAuth } = require("../middleware/login.middleware");

const momentController = require("../controller/moment.controller");
const { verifyPermission } = require("../middleware/permisson.middleware");

const momentRouter = new KoaRoter({ prefix: "/moment" });

// 增加动态
momentRouter.post("/", verifyAuth, momentController.create);
// 查询动态
momentRouter.post("/list", verifyAuth, momentController.list);
momentRouter.post("/detail", verifyAuth, momentController.detail);

// 删除动态
momentRouter.post("/delete", verifyAuth, verifyPermission, momentController.delete);

// 修改动态

momentRouter.post("/update", verifyAuth, verifyPermission, momentController.update);

/* // 删除动态
momentRouter.post("/delete", verifyAuth, verifyPermission('moment'), momentController.delete);

// 修改动态

momentRouter.post("/update", verifyAuth, verifyPermission('moment'), momentController.update);
 */

/* 
1、是否已经登陆
2、验证是否有操作的权限
3、验证label是否存在表中
 * 存在直接使用
 * 不存在需要先添加
4、最终步骤 添加到关系表
*/

momentRouter.post("/labels", verifyAuth, verifyAuth, (ctx, next) => {
  ctx.body = "nihao";
});
module.exports = momentRouter;
